CanciĆ³n Abril


    int crotchet= 100;
    int minim=2*crotchet;
    int semiBreve=4*crotchet;
    int quaver=crotchet/2;
    int semiQuaver=crotchet/4;
    int deniSemiQuaver=crotchet/8;
    int crotchetWithPoint=crotchet+quaver;
    int minimWithPoint=minim+crotchet;
    int crotchetSilence=crotchet;
    int minimSilence=minim;
   
    const int semiBreveSilence=semiBreve; 
    const int quaverSilence=quaver;
    const int semiQuaverSilence=SemiQuaver;
    
    const long DO=523.25;
    const long RE=587.33;
    const long MI=659.26;
    const long FA=698.46;
    const long SOL=783.99;
    const long LA=880;
    const long SI=987.77;
    const long PAU=30000;
    
    const int speakerOut=8;
    const int nextNote=200;
    const int nextBlock=300;
    const int element=34; 
    
    void setup(){
    pinMode(speakerOut,OUTPUT);}
    void loop(){
    int melody[]={MI,PAU,MI,MI,MI,PAU,MI,PAU,MI,FA,PAU,SOL,FA,PAU,MI,PAU,MI,FA,MI,FA,PAU,SOL,FA,PAU,MI,PAU,MI,FA,MI,FA,PAU,SOL,PAU,SOL};
    int duration[]={crotchetWithPoint,nextNote,quaver,crotchet,crotchet,nextNote,crotchet,nextBlock,...crotchet};
    for(int note=0;note< elements;note++){
    tone(speakerOut,melody[note]);
    delay(duration[note]);
    notone(speakerOut);}}
    
    

En un teclat amb 88 tecles hi han 7 o 8 octaves, l'oida humana va de 20hz a 20khz